{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Simple script to compare images. Let's assume we have the following three images:\n",
    "<table>\n",
    "<tr>\n",
    "<td><img src=\"images/flair.png\" alt=\"FLAIR\" style=\"width: 200px;\"/></td>\n",
    "<td><img src=\"images/b0.png\" alt=\"DWI b0\" style=\"width: 200px;\"/></td>\n",
    "<td><img src=\"images/b1000.png\" alt=\"DWI b1000\" style=\"width: 200px;\"/></td>\n",
    "</tr>\n",
    "<tr>\n",
    "<td>FLAIR</td>\n",
    "<td>DWI b0</td>\n",
    "<td>DWI b1000</td>\n",
    "</tr>\n",
    "</table>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Comparing an image with itself yields no differences."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "No other difference.\n"
     ]
    }
   ],
   "source": [
    "medpy_diff.py resources/flair.nii.gz resources/flair.nii.gz"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Comparing images with different dimensionality compares the meta-data but not the content."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Dtype differs: float32 to uint16\n",
      "Shape differs: (181, 217) to (1024, 1024)\n",
      "The voxel content of images of different shape can not be compared. Exiting.\n"
     ]
    },
    {
     "ename": "",
     "evalue": "255",
     "output_type": "error",
     "traceback": []
    }
   ],
   "source": [
    "medpy_diff.py resources/flair.nii.gz resources/b0.nii.gz"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For fitting images, a summary of the content differences is provided."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Voxel differ: 1047071 of 1048576 total voxels\n",
      "Max difference: 65535\n"
     ]
    }
   ],
   "source": [
    "medpy_diff.py resources/b0.nii.gz resources/b1000.nii.gz"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Bash",
   "language": "bash",
   "name": "bash"
  },
  "language_info": {
   "codemirror_mode": "shell",
   "file_extension": ".sh",
   "mimetype": "text/x-sh",
   "name": "bash"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
